package com.example.tabbar.fragment

import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.CheckBox
import androidx.lifecycle.ViewModelProvider
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.example.tabbar.adapter.DetailsDataAdapter
import com.example.tabbar.databinding.FragmentDetailsDataBinding
import com.example.tabbar.utils.CustomLine
import com.junray.usermangement.viewModel.MeasurementViewModel


class DetailsDataFragment : Fragment() {
    private var binding : FragmentDetailsDataBinding? = null
    private var meaViewModel: MeasurementViewModel? = null

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        arguments?.let {}
    }
    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        binding = FragmentDetailsDataBinding.inflate(inflater,container,false)
        return binding?.root
    }
    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {

        super.onViewCreated(view, savedInstanceState)
        initView()

        binding?.text?.setOnClickListener {
            (parentFragment as SearchFragment).backToSamplingList()
        }
    }

    private fun initView() {
        meaViewModel = ViewModelProvider(this)[(MeasurementViewModel::class.java)]


//        meaViewModel?.getPavedSamplingData()?.observe(viewLifecycleOwner) { item: List<com.junray.usermangement.room.bean.SamplingData>? ->
//            if (!item.isNullOrEmpty()) {
//                adapter?.setItems(item)
//            }
//        }

    }

    companion object {

        @JvmStatic
        fun newInstance() =
            DetailsDataFragment().apply {
                arguments = Bundle().apply {

                }
            }
    }
}